<template>
  <view class="container">
    <!-- 发薪日倒计时卡片 -->
    <view class="payday-countdown-card">
      <view class="card-header">
        <text class="title">距离发薪日</text>
        <text class="next-payday">下次发薪: {{ nextPayday }}</text>
      </view>
      <view class="countdown-timer">
        <view class="time-block">
          <text class="number">{{ paydayCountdown.days }}</text>
          <text class="unit">天</text>
        </view>
        <text class="separator">:</text>
        <view class="time-block">
          <text class="number">{{ paydayCountdown.hours }}</text>
          <text class="unit">时</text>
        </view>
        <text class="separator">:</text>
        <view class="time-block">
          <text class="number">{{ paydayCountdown.minutes }}</text>
          <text class="unit">分</text>
        </view>
        <text class="separator">:</text>
        <view class="time-block">
          <text class="number">{{ paydayCountdown.seconds }}</text>
          <text class="unit">秒</text>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import timer from '../../mixins/timer'

export default {
  name: 'Timers',
  mixins: [timer],

  mounted() {
    this.startTimer()
  },

  beforeDestroy() {
    this.clearTimer()
  }
}
</script>

<style lang="scss">
.container {
  min-height: 100vh;
  background: #f8fafc;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.payday-countdown-card {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.2);

  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;

    .title {
      font-size: 24px;
      color: rgba(255, 255, 255, 0.9);
      font-weight: 500;
    }

    .next-payday {
      font-size: 18px;
      color: rgba(255, 255, 255, 0.7);
      background: rgba(255, 255, 255, 0.1);
      padding: 4px 12px;
      border-radius: 12px;
    }
  }

  .countdown-timer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;

    .time-block {
      background: rgba(255, 255, 255, 0.1);
      border-radius: 16px;
      padding: 16px;
      min-width: 80px;
      text-align: center;

      .number {
        font-size: 48px;
        font-weight: 700;
        color: #fff;
        display: block;
        margin-bottom: 4px;
        font-family: monospace;
      }

      .unit {
        font-size: 16px;
        color: rgba(255, 255, 255, 0.7);
      }
    }

    .separator {
      font-size: 32px;
      font-weight: 300;
      color: rgba(255, 255, 255, 0.5);
      margin-top: -8px;
    }
  }
}
</style> 